import HostConfig from '@/utils/host.js';
import Host from '@/utils/api.js';

export default {
	isLogin(){//判断是否有注册成为会员了
		let that = this;
		uni.login({
		  provider: 'weixin',
		  success: function (loginRes) {
			uni.request({
			    url: Host.ApiGetOpenid.url, //仅为示例，并非真实接口地址。
				method: 'GET',
			    data: {
			        code: loginRes.code,
			    },
			    success: (res) => {
					console.log(res.data.openid)
					// that.globalData.openid = res.data.openid;
					uni.request({
					    url: Host.ApiGetuserInfo.url, //仅为示例，并非真实接口地址。
						method: 'GET',
					    data: {
					        openid: res.data.openid,
					    },
					    success: (res) => {
							that.userInfo =  {'openid': res.data.openid, 'userInfo': res.data};
					    }
					});
			    }
			});
		  }
		});
	}
}